;;;
;;;	Author: Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com
;;;	All rights reserved.
;;;
;;;	Copyright:
;;;	   Edited:
;;;
(DEFUN C:COIRWATTLE ()
  (IF (FINDFILE "coir-wattle-pl.dwg")
    (COMMAND ".insert" (STRCAT "coir-wattle-pl=" (FINDFILE "coir-wattle-pl.dwg")) nil nil nil)
  )
  (IF get_gpdgn_project_data NIL (LOAD "get_gpdgn_project_data" "\nFile GET_GPDGN_PROJECT_DATA.LSP not loaded! "))
  (get_gpdgn_project_data)
  (IF gpdgn_line_number_str
    (PROGN
      (SETQ cnt 1)
      (WHILE (WCMATCH (SUBSTR gpdgn_line_number_str cnt) "*-*")
        (SETQ cnt (1+ cnt))
      )
      (IF (< (ATOI (SUBSTR gpdgn_line_number_str cnt)) 10)
        (SETQ line_no (STRCAT "0" (SUBSTR gpdgn_line_number_str cnt)))
        (SETQ line_no (SUBSTR gpdgn_line_number_str cnt))
      )
      (COND
        ((WCMATCH gpdgn_line_number_str "W-*,WM*")
         (SETQ line_type "WM"))
        ((WCMATCH gpdgn_line_number_str "S-*,SS*")
         (SETQ line_type "SS"))
        ((WCMATCH gpdgn_line_number_str "SD*")
         (SETQ line_type "SD"))
        ((WCMATCH gpdgn_line_number_str "FM*")
         (SETQ line_type "FM"))
      )
    )
    (PROGN
      (IF ustr NIL (LOAD "ustr" "\nFile USTR.LSP not loaded! "))
      (SETQ line_type NIL
            line_no   NIL
      )
      (IF line_str NIL (SETQ line_str ""))
      (WHILE (NOT (WCMATCH line_str "[WSFE][MSDC]##"))
        (SETQ line_str (ustr 1 "Line ID (4-characters, [WSFE][MSDC]##, no spaces)" (IF line_str line_str "WM00") NIL))
      )
    )
  )
  (IF layentmake NIL (LOAD "mklayr" "\nFile MKLAYR.LSP not loaded! "))
  (SETQ coir-layer
         (STRCAT
           "C-PLAN3"
           (IF (AND line_type line_no)
             (STRCAT line_type line_no)
             line_str
           )
           "-EC"
         )
        coir-blk "coir-wattle-pl"
        coir-dist (uint 1 "" "Distance between wattles" (IF coir-dist coir-dist 25))
        coir-blk-align "Yes"
  )
  (layentmake (STRCASE coir-layer) "3" "continuous")
  (SETQ mat-sel (SSGET '((-4 . "<OR")(0 . "POLYLINE")(0 . "LWPOLYLINE")(-4 . "OR>"))))
  (SETQ this-ent (SSNAME mat-sel 0))
  (COMMAND ".MEASURE" this-ent "Block" coir-blk coir-blk-align coir-dist)
  (PRINC)
)